home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cmouse / gmouscur.i < prev    next >
Text File  |  1987-12-25  |  4KB  |  103 lines

  1. /* GMOUSCUR.I is an #include file defining several graphics mouse  */
  2. /*   cursor patterns. All are statics.                             */
  3. /* This file also contains an event handler called by the mouse    */
  4. /*   device driver, and a global event record variable 'theEvents' */
  5. /* Must #include MOUSE.I above this #include file.                 */
  6. /* --------------------------------------------------------------- */
  7.  
  8. typedef struct {                             /* mouse event record */
  9.       unsigned  flag, button, col, row;
  10.     } EVENTREC;
  11.  
  12. typedef struct {                     /* graphics cursor descriptor */
  13.           unsigned  *image;
  14.           unsigned  hotX, hotY;
  15.         } GCURSREC;
  16.  
  17. /* check mark image */
  18. static unsigned checkIm [32] = {
  19.             0xFFF0, 0xFFE0, 0xFFC0, 0xFF81,         /* screen mask */
  20.             0xFF03, 0x0607, 0x000F, 0x001F,
  21.             0xC03F, 0xF07F, 0xFFFF, 0xFFFF,
  22.             0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
  23.             0x0000, 0x0006, 0x000C, 0x0018,         /* cursor mask */
  24.             0x0030, 0x0060, 0x70C0, 0x1D80,
  25.             0x0700, 0x0000, 0x0000, 0x0000,
  26.             0x0000, 0x0000, 0x0000, 0x0000 };
  27.  
  28. /* Left arrow image */
  29. static unsigned LArrIm [32] = {
  30.             0xFE1F, 0xF01F, 0x0000, 0x0000,         /* screen mask */
  31.             0x0000, 0xF01F, 0xFE1F, 0xFFFF,
  32.             0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
  33.             0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
  34.             0x0000, 0x00C0, 0x07C0, 0x7FFE,         /* cursor mask */
  35.             0x07C0, 0x00C0, 0x0000, 0x0000,
  36.             0x0000, 0x0000, 0x0000, 0x0000,
  37.             0x0000, 0x0000, 0x0000, 0x0000 };
  38.  
  39. /* Cross image */
  40. static unsigned crossIm [32] = {
  41.             0xFC3F, 0xFC3F, 0xFC3F, 0x0000,         /* screen mask */
  42.             0x0000, 0x0000, 0xFC3F, 0xFC3F,
  43.             0xFC3F, 0xFFFF, 0xFFFF, 0xFFFF,
  44.             0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
  45.             0x0000, 0x0180, 0x0180, 0x0180,         /* cursor mask */
  46.             0x7FFE, 0x0180, 0x0180, 0x0180,
  47.             0x0000, 0x0000, 0x0000, 0x0000,
  48.             0x0000, 0x0000, 0x0000, 0x0000 };
  49.  
  50. /* Pointing hand image */
  51. static unsigned handIm [32] = {
  52.             0xE1FF, 0xE1FF, 0xE1FF, 0xE1FF,         /* screen mask */
  53.             0xE1FF, 0xE000, 0xE000, 0xE000,
  54.             0x0000, 0x0000, 0x0000, 0x0000,
  55.             0x0000, 0x0000, 0x0000, 0x0000,
  56.             0x1E00, 0x1200, 0x1200, 0x1200,         /* cursor mask */
  57.             0x1200, 0x13FF, 0x1249, 0x1249,
  58.             0x1249, 0x9001, 0x9001, 0x9001,
  59.             0x8001, 0x8001, 0x8001, 0xFFFF };
  60.  
  61. static unsigned iBeamIm [32] = {
  62.             0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,         /* screen mask */
  63.             0XFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
  64.             0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
  65.             0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
  66.             0xF00F, 0x0C30, 0x0240, 0x0240,         /* cursor mask */
  67.             0x0180, 0x0180, 0x0180, 0x0180,
  68.             0x0180, 0x0180, 0x0180, 0x0180,
  69.             0x0240, 0x0240, 0x0C30, 0xF00F };
  70.  
  71. /* Graphics cursor descriptors */
  72. static GCURSREC check = {NULL, 6, 7};
  73. static GCURSREC arrow = {NULL, 0, 3};
  74. static GCURSREC cross = {NULL, 7, 4};
  75. static GCURSREC hand  = {NULL, 5, 0};
  76. static GCURSREC iBeam = {NULL, 7, 7};
  77.  
  78. /* Global far pointer to mouse event record */
  79. static EVENTREC far *theEvents;
  80. /* --------------------------------------------------------------- */
  81.  
  82. void far handler (void)   /* event handler called by device driver */
  83. {
  84. EVENTREC   far *save;      /* pointer to save area in diff segment */
  85. unsigned   a, b, c, d;                /* temp storage of registers */
  86.  
  87.   a = _AX, b = _BX, c = _CX, d = _DX;            /* save registers */
  88.   save = MK_FP (_CS-0x10, 0x00C0);       /* point to PSP user area */
  89.   save->flag   = a;                     /* stuff registers into it */
  90.     save->button = b;
  91.   save->col    = c;
  92.   save->row    = d;
  93. } /* ------------------------ */
  94.  
  95. void initGCurs (void)     /* initialize ptrs in cursor descriptors */
  96. {
  97.   check.image = checkIm;
  98.   arrow.image = LArrIm;
  99.   cross.image = crossIm;
  100.   hand.image  = handIm;
  101.   iBeam.image = iBeamIm;
  102. } /* ------------------------ */
  103. /* End of GMOUSCUR.I */